/**
 * 新增子账号
 * 宁建浩
 * 2017/8/21  14:00
 * */
var testConfig = require('../testConfig');
var testDatas = require('../testData');
function TestProject() {
  this.init = function () {
    var arr = [];
    arr.push(this.step1,
      this.step2,
      this.step3,
      this.step4,
      this.step5,
      this.step6,
      this.step7,
      this.step8,
      this.step9,
      this.step10,
      this.step11,
      this.step12
    );
    testConfig.testFun.runStep(arr);
  };
  this.step1 = function () {
    $("#aside-nav").find("div.coords").eq(1).find("a")[0].click();
  };
  this.step2 = function () {
    $("#collapse2").find("li:nth-child(3) .second_lv_li")[0].click();
  };
  this.step3 = function () {
    testConfig.testFun.ai().find('.addTeamBtn')[0].click();
  };
  this.step4 = function () {
    testConfig.testFun.ai().find('.addTeamBtn').siblings("ul").find("li:nth-child(2) a")[0].click();
  };
  this.step5 = function () {
    testConfig.testFun.bi().find('.tenant-name')[0].click();
  };
  this.step6 = function () {
    testConfig.testFun.ci().find(".text-center .pagination li:nth-of-type(8) a")[0].click();
  };
  this.step7 = function () {
    testConfig.testFun.ci().find("#lesTable tbody tr:last-child td")[0].click();
  };
  this.step8 = function () {
    testConfig.testFun.bi().find("input[data-name='childName']").val(testDatas.testFun.childName);
  };
  this.step9 = function () {
    testConfig.testFun.bi().find("input[data-name='unitName']").val(testDatas.testFun.unitName);
  };
  this.step10 = function () {
    var userName = testConfig.testFun.bi().find("input[data-name='userName']:last").val();
    var childName = testConfig.testFun.bi().find("input[data-name='childName']").val();
    testConfig.searchName = userName + ":" + childName;
    testConfig.testFun.bi().find('#confirmBtn')[0].click();
  };
  this.step11 = function () {
    var searchName = testConfig.searchName;
    testConfig.testFun.ai().find("input[data-name='userName']").val(searchName);
  };
  this.step12 = function () {
    testConfig.testFun.ai().find('#queryBtn')[0].click();
  };
}
function testStart() {
  var test = new TestProject();
  test.init();
}
exports.start = testStart;